package framework.gui.panels;

import javax.swing.BoxLayout;
import javax.swing.JPanel;

import framework.cellularAutomaton.CellularAutomaton;

/**
 * The panel that initializes and manages contains the 
 * grid the user will be viewing and the buttons the user 
 * will be interacting with.
 * 
 * @author Alex Duda
 */

@SuppressWarnings("serial")
public class LifePanel extends JPanel{	
	
	private TopButtonPanel topButtonPanel;
	private GridPanel gridPanel;
	private BottomButtonPanel bottomButtonPanel;
	
	/**
	 * Creates the only panel with which the user interacts
	 * @param CA the controlling instance of this class
	 */
	
	public LifePanel(CellularAutomaton CA){
		setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		
		gridPanel = new GridPanel(CA);
		bottomButtonPanel = new BottomButtonPanel(gridPanel);
		topButtonPanel = new TopButtonPanel(gridPanel, CA);
		
		gridPanel.addButtonPanelReference(bottomButtonPanel);
		
		add(topButtonPanel);
		add(gridPanel);
		add(bottomButtonPanel);
	}
	
}